<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
	<title>娱管家</title>  
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="x5-orientation" content="portrait">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Access-Control-Allow-Origin" content="">
	<meta http-equiv="content-security-policy">
	<script type="text/javascript" src="js/jquery.min.js" ></script>
	<link rel="stylesheet" type="text/css" href="css/fen.css"/>
	<link rel="stylesheet" type="text/css" href="icon-font/iconfont.css"/>
</head>
<body>
	<div class="pHead header1 header_1 mui-bar mui-bar-nav" id="Land_header">
		<h2>登陆</h2>
	</div>
	<div class="pBody qq Land mui-content" id="Land_height">
		<div class="top">
			<img src="images/logo.png" alt="logo" class="logo" />
			<p class="logo-btm">娱管家</p>
		</div>
		<div class="Land relative">
			<input type="text" placeholder="手机号" class="phone" id="login_phone" value="" />
			<span class="iconfont icon-wode wode"></span>
			<input type="password" placeholder="密码" id="login_pwd" value="" />
			<span class="iconfont icon-mima mima"></span>
			<div class="Land-text clearfix">
				<p class="fl-left"></p>
				<p class="fl-right"></p>
			</div>
			<button id="login">登陆</button>
		</div>
	</div>
	<div class="" id="tan2"></div>
	<script src="js/base.js"></script>
	<script type="text/javascript">
		var login = 'http://www.yuzhuli.com/api.php/Api/login';
		function GetQueryString(name){
		     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
		     var r = window.location.search.substr(1).match(reg);
		     if(r!=null)return  unescape(r[2]); return null;
		}
		
		var id = GetQueryString('id');
		var token = GetQueryString('token');
		
		
		$('#login').click(function(){			
			var loginPhone = $("#login_phone").val();
			var loginPwd = $("#login_pwd").val();
			var cid = getCache("cid");
			$.post(login,{phone:loginPhone,pwd:loginPwd,cid:cid},function(obj){
				if(obj.s){
					setCache('token', obj.d);
					setCache('hxUser',loginPhone);
					setCache('hxPass','123456');
					setCache('mesList', []);
					location.href = 'shop.html?id='+id+'&token='+token;
					$("#login_phone").val("");
					$("#login_pwd").val("");
				} else {
					tan("登录失败，请检查手机号与密码");
				}
			});
		})
		
		
		//存储
		function setCache(key,value){
			localStorage.setItem(key,JSON.stringify(value));
		}
		//取缓存  keys 键 
		function getCache(key){
			if(localStorage.getItem(key)){
				return JSON.parse(localStorage.getItem(key));
			}else{
				return false;
			}
		}
		//删除缓存 keys
		function remove(key){
			localStorage.removeItem(key);
		}
		function tan(text2){
			$("#tan2").addClass("tan");
			$("#tan2").text(text2);
			clearTimeout(a);
			var a = setTimeout (function(){
				ding();
			},2000);
			function ding (){
				$("#tan2").removeClass("tan");
				$("#tan2").text("");
			};
		}

//		
	</script>
</body>
</html>
